package com.heima.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.domain.po.Business;
import com.heima.domain.vo.BusinessVo;
import com.heima.mapper.BusinessMapper;
import com.heima.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> implements BusinessService {

    @Autowired
    private BusinessMapper businessMapper;

    /**
     * 查询商圈列表
     *
     * @return
     */
    @Override
    public List<BusinessVo> findAll() {

        Wrapper<Business> wrepper = new QueryWrapper<>();
        List<Business> businesses = businessMapper.selectList(wrepper);
        List<BusinessVo> list = BeanUtil.copyToList(businesses, BusinessVo.class);
        return list;
    }
}
